/*    */ package com.zimbra.cs.util.yauth;
/*    */ 
/*    */ import junit.framework.TestCase;
/*    */ import org.apache.log4j.BasicConfigurator;
/*    */ import org.apache.log4j.Level;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class AuthTest
/*    */   extends TestCase
/*    */ {
/*    */   private static final String APPID = "D2hTUBHAkY0IEL5MA7ibTS_1K86E8RErSSaTGn4-";
/*    */   private static final String USER = "dacztest";
/*    */   private static final String PASS = "test1234";
/*    */   private static String token;
/*    */   
/*    */   static
/*    */   {
/* 32 */     BasicConfigurator.configure();
/* 33 */     Logger.getRootLogger().setLevel(Level.DEBUG);
/*    */   }
/*    */   
/*    */   private static String getToken() throws Exception {
/* 37 */     if (token == null) {
/* 38 */       token = RawAuth.getToken("D2hTUBHAkY0IEL5MA7ibTS_1K86E8RErSSaTGn4-", "dacztest", "test1234");
/*    */     }
/* 40 */     return token;
/*    */   }
/*    */   
/*    */   public void testToken() throws Exception {
/* 44 */     token = getToken();
/* 45 */     assertNotNull(token);
/*    */   }
/*    */   
/*    */   public void testAuthenticate() throws Exception {
/* 49 */     RawAuth auth = RawAuth.authenticate("D2hTUBHAkY0IEL5MA7ibTS_1K86E8RErSSaTGn4-", getToken());
/* 50 */     assertNotNull(auth.getWSSID());
/* 51 */     assertNotNull(auth.getCookie());
/*    */   }
/*    */   
/*    */   public void testInvalidPassword() throws Exception {
/* 55 */     Exception error = null;
/*    */     try {
/* 57 */       RawAuth.getToken("D2hTUBHAkY0IEL5MA7ibTS_1K86E8RErSSaTGn4-", "dacztest", "invalid");
/*    */     } catch (AuthenticationException e) {
/* 59 */       error = e;
/*    */     }
/* 61 */     assertNotNull(error);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/util/yauth/AuthTest.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */